<?php

class data{
    public function __construct(){
        
        $this->conn = new mysqli('localhost','root','root','php');
        
        if(!conn){
            echo "连接失败";
            exit;
        }
    }
    
    public function getQuery($sql){
        $res = $this->conn->query($sql);
        
        return $res;
    }
    
   
}

$d = new data();
$r = $d->getQuery("select * from news");

while($row = $r->fetch_array(MYSQLI_ASSOC)){
    $rows[] = $row;
   
}
define('path1', dirname(__FILE__));
echo path1;
echo 123123123;
// echo count($rows);
// print_r($rows);